package com.baizhi.wd.action;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.baizhi.wd.service.TelbookService;
import com.baizhi.wd.service.TelbookServiceImpl;

public class DeletePersonAction extends HttpServlet {
	public void service(HttpServletRequest request,HttpServletResponse response) throws IOException{
		try{
			//1获取client数据
			String idd = request.getParameter("id");
			int id = Integer.parseInt(idd);
			//2调用业务类的方法
			TelbookService ts = new TelbookServiceImpl();
			ts.dropPerson(id);
/*			request.setCharacterEncoding("utf-8");
			request.setAttribute("String", "删除成功");*/
			//3根据结果跳转--重定向
			response.sendRedirect("/telbook_2/per/queryAllAction");
		}catch(Exception e){
			e.printStackTrace();
			response.sendRedirect("/telbook_2/catchError.html");
		}
	}
}
